package com.itheima.wemedia.vo;

import com.itheima.wemedia.pojo.WmNews;
import com.itheima.wemedia.pojo.WmUser;
import lombok.Data;
import org.springframework.beans.BeanUtils;

/**
 * @version 1.0
 * @description 说明
 * @package com.itheima.wemedia.vo
 */
@Data
public class WmNewsVo extends WmNews {

    /** 作者名称 */
    private String authorName;

    //app端用户Id 文章同步时要用到
    private Integer apUserId;

    public static WmNewsVo build(WmNews wmNews, WmUser wmUser){
        WmNewsVo vo = new WmNewsVo();
        BeanUtils.copyProperties(wmNews,vo);
        vo.setAuthorName(wmUser.getName());
        vo.setApUserId(wmUser.getApUserId());
        return vo;
    }
}
